package com.moonlit.myspring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;

/**
 *  @Autowired 自动装配的注解
 *  如果两个实现类同时实现了一个接口，那么可以使用 @Qualifier("halberd") 来选取你想要的实现
 */
@Component("guanYu")
public class GuanYu implements Hero{
    @Autowired
    @Qualifier("falchion")


    private Weapon weapon;


    @Override
    public void perform() {
        System.out.println("GuanYu pick up his weapon");
        weapon.attack();
    }
}
